#include <iostream>


#include "XMLDiscover.hpp"
#include "FieldNameLookup.hpp"

bool testDiscover(std::string strURL)
{
   XMLDiscover xml;
   
   //std::cout << "Discovering ...\n" << strURL << "\n\n";
   
   if (!xml.fetchPage(strURL)) 
   {
      std::cout << "testDiscover() - Error fetchPage().\n";  
      return false;
   }
   
   if (!xml.parseXMLData())
   {
      std::cout << "testDiscover() - Error parseXMLData().\n";  
      std::cout << xml.getXML();
      return false;
   }
 
   if (xml.vecNames.empty()) 
   {
      std::cout << "testDiscover() - Error vecNames is empty.\n";
      return false;
   }

   if (!xml.buildSQLCreateTable())
   {
      std::cout << "testDiscover() - Error buildSQLCreateTable.\n";
      return false;
   }
     
   std::cout << xml.getSQLCreateTable() << "\n";
   
   return true;
   
}